<%@page import="java.util.List"%>
<%@ page import="cn.ustb.entity.CourseScheduleShow" %>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<title>课程查询</title>
	<link rel="stylesheet" href="layui-v2.8.4/layui/css/layui.css">
</head>
<body>
<ul class="layui-nav layui-bg-gray" lay-unselect="false">
	<li class="layui-nav-item">
		<a href="javascript:;">选课报名</a>
		<dl class="layui-nav-child">
			<dd><a href="<%=request.getContextPath()%>/courseselect.jsp">选修课报名</a></dd>
			<dd><a href="<%=request.getContextPath()%>/levelexamapply.jsp">考级报名</a></dd>
		</dl>
	</li>
	<li class="layui-nav-item">
		<a href="javascript:;">业务办理</a>
		<dl class="layui-nav-child">
			<dd>
				<a href="<%=request.getContextPath()%>/postponeExamApply.jsp">缓考申请</a>
			</dd>
			<dd>
				<a href="<%=request.getContextPath()%>/exemptionapply.jsp">免修申请</a>
			</dd>
		</dl>
	</li>
	<li class="layui-nav-item">
		<a href="javascript:;">信息查询</a>
		<dl class="layui-nav-child">
			<dd><a href="<%=request.getContextPath()%>/studentInformationServlet.do">学籍信息</a></dd>
			<dd><a href="<%=request.getContextPath()%>/courseSchedule.jsp">课表查询</a></dd>
			<dd><a href="<%=request.getContextPath()%>/studentQuery.grade">课程成绩</a></dd>
			<dd><a href="<%=request.getContextPath()%>/examArrange.jsp">考试安排</a></dd>
		</dl>
	</li>
	<li class="layui-nav-item">
		<a href="<%=request.getContextPath()%>/modifypassword.jsp">修改密码</a>
	</li>
	<li class="layui-nav-item">
		<a href="<%=request.getContextPath()%>/logoutServlet">注销</a>
	</li>
	<li class="layui-nav-item">${sessionScope.user.name },您好！</li>
</ul>
<br>

	<form action="<%=request.getContextPath()%>/courseScheduleServlet.do"  method="post">
		<div class="layui-form layui-row layui-col-space16">
			<div class="layui-col-md6">
				<input id="a" type="hidden" value="${param.yearTerm}">
				学年学期:
					<select name="yearTerm">
						<option value=""></option>
						<c:choose>
							<c:when test="${empty param.yearTerm or param.yearTerm ne '2023秋季'}">
								<option value="2023秋季">2023秋季</option>
							</c:when>
							<c:otherwise>
								<option value="2023秋季" selected="selected">2023秋季</option>
							</c:otherwise>
						</c:choose>
						<c:choose>
							<c:when test="${empty param.yearTerm or param.yearTerm ne '2023春季'}">
								<option value="2023春季">2023春季</option>
							</c:when>
							<c:otherwise>
								<option value="2023春季" selected="selected">2023春季</option>
							</c:otherwise>
						</c:choose>
						<c:choose>
							<c:when test="${empty param.yearTerm or param.yearTerm ne '2022秋季'}">
								<option value="2022秋季">2022秋季</option>
							</c:when>
							<c:otherwise>
								<option value="2022秋季" selected="selected">2022秋季</option>
							</c:otherwise>
						</c:choose>
						<c:choose>
							<c:when test="${empty param.yearTerm or param.yearTerm ne '2022春季'}">
								<option value="2022春季">2022春季</option>
							</c:when>
							<c:otherwise>
								<option value="2022春季" selected="selected">2022春季</option>
							</c:otherwise>
						</c:choose>
<%--						<option value="2023秋季">2023秋季</option>--%>
<%--						<option value="2023春季">2023春季</option>--%>
<%--						<option value="2022秋季">2022秋季</option>--%>
<%--						<option value="2022春季">2022春季</option>--%>
					</select>
			</div>


			<div class="layui-col-md6">
				周次：
					<select name="week">
						<option value=""></option>
						<c:forEach var="i" begin="1" end="20">
							<c:choose>
								<c:when test="${empty param.week or param.week ne '第'.concat(i).concat('周')}">
									<option value="第${i}周">第${i}周</option>
								</c:when>
								<c:otherwise>
									<option value="第${i}周" selected="selected">第${i}周</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
			</div>
			<div class="layui-btn-container">
				<button type="submit" class="layui-btn">查询</button>
			</div>
		</div>

	</form>
	<c:if test="${sessionScope.courseScheduleShows != null }">
		<table border="2" cellpadding="0" cellspacing="0">
				<tr>
					<th height="50px"></th>
					<th height="50px">星期一</th>
					<th height="50px">星期二</th>
					<th height="50px">星期三</th>
					<th height="50px">星期四</th>
					<th height="50px">星期五</th>
					<th height="50px">星期六</th>
					<th height="50px">星期日</th>
				</tr>
				<%
					
					List<CourseScheduleShow> courseScheduleShows = (List<CourseScheduleShow>)session.getAttribute("courseScheduleShows");
					session.removeAttribute("courseScheduleShows");
					for(CourseScheduleShow courseScheduleShow : courseScheduleShows){		
				%>	
					<tr>
						<td align="center" height="100px" width="100px"><%=courseScheduleShow.getJoint() %></td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getMonday() != null){
							%>	
							<%=courseScheduleShow.getMonday().getCourse() %>
							<br>
							<%=courseScheduleShow.getMonday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getMonday().getClassplace() %>
							<% 
								}
							%>	
												
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getTuesday() != null){
							%>	
							<%=courseScheduleShow.getTuesday().getCourse() %>
							<br>
							<%=courseScheduleShow.getTuesday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getTuesday().getClassplace() %>
							<% 
								}
							%>	
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getWesneday() != null){
							%>	
							<%=courseScheduleShow.getWesneday().getCourse() %>
							<br>
							<%=courseScheduleShow.getWesneday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getWesneday().getClassplace() %>
							<% 
								}
							%>	
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getThursday() != null){
							%>	
							<%=courseScheduleShow.getThursday().getCourse() %>
							<br>
							<%=courseScheduleShow.getThursday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getThursday().getClassplace() %>
							<% 
								}
							%>	
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getFriday() != null){
							%>	
							<%=courseScheduleShow.getFriday().getCourse() %>
							<br>
							<%=courseScheduleShow.getFriday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getFriday().getClassplace() %>
							<% 
								}
							%>	
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getSaturday() != null){
							%>	
							<%=courseScheduleShow.getSaturday().getCourse() %>
							<br>
							<%=courseScheduleShow.getSaturday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getSaturday().getClassplace() %>
							<% 
								}
							%>	
						</td>
						<td height="100px" width="150px">
							<%
								if(courseScheduleShow.getSunday() != null){
							%>	
							<%=courseScheduleShow.getSunday().getCourse() %>
							<br>
							<%=courseScheduleShow.getSunday().getTeacher() %>
							<br>
							<%=courseScheduleShow.getSunday().getClassplace() %>
							<% 
								}
							%>	
						</td>
					</tr>
				<%						
					}
				%>
			</table>
		</c:if>
	<script src="layui-v2.8.4/layui/layui.js"></script>
	<link type="text/css" rel="stylesheet" href="layui-v2.8.4/layui/css/layui.css"/>
</body>
</html>